/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.eclipsecon.dui.swtmodel.util;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

import org.eclipsecon.dui.swtmodel.*;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see org.eclipsecon.dui.swtmodel.SwtmodelPackage
 * @generated
 */
public class SwtmodelSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static SwtmodelPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SwtmodelSwitch() {
		if (modelPackage == null) {
			modelPackage = SwtmodelPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case SwtmodelPackage.MCOMPOSITE: {
				MComposite mComposite = (MComposite)theEObject;
				T result = caseMComposite(mComposite);
				if (result == null) result = caseMControl(mComposite);
				if (result == null) result = caseStyledElement(mComposite);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MCOLOR: {
				MColor mColor = (MColor)theEObject;
				T result = caseMColor(mColor);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MCONTROL: {
				MControl mControl = (MControl)theEObject;
				T result = caseMControl(mControl);
				if (result == null) result = caseStyledElement(mControl);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MBUTTON: {
				MButton mButton = (MButton)theEObject;
				T result = caseMButton(mButton);
				if (result == null) result = caseMControl(mButton);
				if (result == null) result = caseStyledElement(mButton);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MLABEL: {
				MLabel mLabel = (MLabel)theEObject;
				T result = caseMLabel(mLabel);
				if (result == null) result = caseMControl(mLabel);
				if (result == null) result = caseStyledElement(mLabel);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MTEXT: {
				MText mText = (MText)theEObject;
				T result = caseMText(mText);
				if (result == null) result = caseMControl(mText);
				if (result == null) result = caseStyledElement(mText);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MLAYOUT: {
				MLayout mLayout = (MLayout)theEObject;
				T result = caseMLayout(mLayout);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MLAYOUT_DATA: {
				MLayoutData mLayoutData = (MLayoutData)theEObject;
				T result = caseMLayoutData(mLayoutData);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MGRID_LAYOUT: {
				MGridLayout mGridLayout = (MGridLayout)theEObject;
				T result = caseMGridLayout(mGridLayout);
				if (result == null) result = caseMLayout(mGridLayout);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MGRID_DATA: {
				MGridData mGridData = (MGridData)theEObject;
				T result = caseMGridData(mGridData);
				if (result == null) result = caseMLayoutData(mGridData);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MACTION_HANDLER: {
				MActionHandler mActionHandler = (MActionHandler)theEObject;
				T result = caseMActionHandler(mActionHandler);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MCOMBO: {
				MCombo mCombo = (MCombo)theEObject;
				T result = caseMCombo(mCombo);
				if (result == null) result = caseMControl(mCombo);
				if (result == null) result = caseStyledElement(mCombo);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MFONT: {
				MFont mFont = (MFont)theEObject;
				T result = caseMFont(mFont);
				if (result == null) result = caseStyledElement(mFont);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.PARAMETER: {
				Parameter parameter = (Parameter)theEObject;
				T result = caseParameter(parameter);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.CONSTANT: {
				Constant constant = (Constant)theEObject;
				T result = caseConstant(constant);
				if (result == null) result = caseParameter(constant);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.VARIABLE: {
				Variable variable = (Variable)theEObject;
				T result = caseVariable(variable);
				if (result == null) result = caseParameter(variable);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.TEMPLATE: {
				Template template = (Template)theEObject;
				T result = caseTemplate(template);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.TEMPLATE_USAGE: {
				TemplateUsage templateUsage = (TemplateUsage)theEObject;
				T result = caseTemplateUsage(templateUsage);
				if (result == null) result = caseMControl(templateUsage);
				if (result == null) result = caseStyledElement(templateUsage);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.MMODEL: {
				MModel mModel = (MModel)theEObject;
				T result = caseMModel(mModel);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case SwtmodelPackage.STYLED_ELEMENT: {
				StyledElement styledElement = (StyledElement)theEObject;
				T result = caseStyledElement(styledElement);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MComposite</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MComposite</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMComposite(MComposite object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MColor</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MColor</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMColor(MColor object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MControl</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MControl</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMControl(MControl object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MButton</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MButton</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMButton(MButton object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MLabel</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MLabel</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMLabel(MLabel object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MText</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MText</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMText(MText object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MLayout</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MLayout</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMLayout(MLayout object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MLayout Data</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MLayout Data</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMLayoutData(MLayoutData object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MGrid Layout</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MGrid Layout</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMGridLayout(MGridLayout object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MGrid Data</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MGrid Data</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMGridData(MGridData object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MAction Handler</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MAction Handler</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMActionHandler(MActionHandler object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MCombo</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MCombo</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMCombo(MCombo object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MFont</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MFont</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMFont(MFont object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Parameter</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Parameter</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseParameter(Parameter object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Constant</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Constant</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseConstant(Constant object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Variable</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Variable</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseVariable(Variable object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Template</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Template</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTemplate(Template object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Template Usage</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Template Usage</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseTemplateUsage(TemplateUsage object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>MModel</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>MModel</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMModel(MModel object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Styled Element</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Styled Element</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseStyledElement(StyledElement object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //SwtmodelSwitch
